package com.gd.iot.energy.controller.statistics;

import com.gd.iot.energy.annotation.SystemLogRecordMonitor;
import com.gd.iot.energy.entity.ResponseEntity;
import com.gd.iot.energy.pojo.common.vo.PageVO;
import com.gd.iot.energy.pojo.statistics.vo.JumpAndAnticlimaxChartVO;
import com.gd.iot.energy.pojo.statistics.vo.JumpAndAnticlimaxPageVO;
import com.gd.iot.energy.pojo.statistics.vo.ZeroDosagePageVO;
import com.gd.iot.energy.service.statistics.StatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 统计分析-用量分析-突增突减用量分析
 *
 * @author kris
 * @date Created at 2020/8/11 10:50
 */
@Api(value = "统计分析-用量分析-突增突减用量分析",tags = "统计分析-用量分析-突增突减用量分析")
@RestController
@RequestMapping("/admin/jumpAndAnticlimaxDosage")
public class JumpAndAnticlimaxDosageController {

    @Autowired
    private StatisticsService statisticsService;

    @ApiOperation("突增突减用量分析分页列表")
    @SystemLogRecordMonitor("突增突减用量分析分页列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "differenceType", value = "类型(GTE(>=, 0)LTE(<=, 1))", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "differenceValue", value = "值", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "cycle", value = "统计周期，(日, 0)(月, 1)(年, 3)", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "startDate", value = "开始日期", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "endDate", value = "结束日期", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "areaId", value = "区域id", dataType = "string", paramType = "query", example = "", required = false),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "string", paramType = "query", example = "", required = false),
            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "string", paramType = "query", example = "", required = false),
    })
    @PostMapping("/getJumpAndAnticlimaxPageVO")
    public ResponseEntity<PageVO<JumpAndAnticlimaxPageVO>> getJumpAndAnticlimaxPageVO(
            @RequestParam(value = "differenceType",required = true)String differenceType,
            @RequestParam(value = "differenceValue",required = true)String differenceValue,
            @RequestParam(value = "cycle",required = true)String cycle,
            @RequestParam(value = "startDate",required = true)String startDate,
            @RequestParam(value = "endDate",required = true)String endDate,
            @RequestParam(value = "areaId",required = false)Integer areaId,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10")Integer pageSize,
            @RequestParam(value = "pageNum",required = false,defaultValue = "1")Integer pageNum
    ) {

        PageVO<JumpAndAnticlimaxPageVO> pageVO = statisticsService.getJumpAndAnticlimaxPageVO(differenceType,differenceValue,
                cycle,startDate,endDate,areaId,pageSize,pageNum);
        return new ResponseEntity<>(pageVO);
    }

    @ApiOperation("突增突减用量分析图表")
    @SystemLogRecordMonitor("突增突减用量分析图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "differenceType", value = "类型(GTE(>=, 0)LTE(<=, 1))", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "differenceValue", value = "值", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "cycle", value = "统计周期，(日, 0)(月, 1)(年, 3)", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "startDate", value = "开始日期", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "endDate", value = "结束日期", dataType = "string", paramType = "query", example = "", required = true),
            @ApiImplicitParam(name = "areaId", value = "区域id", dataType = "string", paramType = "query", example = "", required = false),
    })
    @PostMapping("/getJumpAndAnticlimaxChartVO")
    public ResponseEntity<List<JumpAndAnticlimaxChartVO>> getJumpAndAnticlimaxChartVO(
            @RequestParam(value = "differenceType",required = true)String differenceType,
            @RequestParam(value = "differenceValue",required = true)String differenceValue,
            @RequestParam(value = "cycle",required = true)String cycle,
            @RequestParam(value = "startDate",required = true)String startDate,
            @RequestParam(value = "endDate",required = true)String endDate,
            @RequestParam(value = "areaId",required = false)Integer areaId
    ) {

        List<JumpAndAnticlimaxChartVO> chartVO = statisticsService.getJumpAndAnticlimaxChartVO(differenceType,differenceValue,
                cycle,startDate,endDate,areaId);
        return new ResponseEntity<>(chartVO);
    }
}
